<?php

include_once $_SERVER['DOCUMENT_ROOT'].'HelmesWorkTest/frontend/controller/formconverters/PersonSectorInvolvementFormConverter.php';

/**
 * Description of PersonSectorInvolvementRequestProcessor
 *
 * @author Reinowin7
 */
class PersonSectorInvolvementRequestProcessor 
{
    const EMPTY_STRING = "";
    const ID_PARSE_EXCEPTION_INDICATOR = -1;

    public function fillPersonSectorInvolvementFormConverterWithRequestData($request)
    {
        $personSectorInvolvementFormConverter = 
                        new PersonSectorInvolvementFormConverter();
        if (isset($_REQUEST["personID"]))
        {
            $personID = $_REQUEST["personID"];
            $personSectorInvolvementFormConverter->setPersonID($personID);
        }
        if (isset($_REQUEST["name"]))
        {
            $name = trim($_REQUEST["name"]);
            $personSectorInvolvementFormConverter->setName($name);
        }
        if (isset($_REQUEST["sectorSelection"]))
        {
            
            $arrayOfSelectedSectorIDs = $_REQUEST["sectorSelection"];
            $personSectorInvolvementFormConverter->setArrayOfSelectedSectorIDs($arrayOfSelectedSectorIDs);
        }
        if (isset($_REQUEST["agreeToTermsCheckbox"]))
        {
            $agreesToTerms = $_REQUEST["agreeToTermsCheckbox"];
            $personSectorInvolvementFormConverter->setAgreesToTerms($agreesToTerms);
        }
        if (isset($_SESSION["listOfAllSectors"]))
        {
            $listOfAllSectors = $_SESSION["listOfAllSectors"];
            $personSectorInvolvementFormConverter->setListOfAllSectors($listOfAllSectors);
        }

        return $personSectorInvolvementFormConverter;
    }
}

?>
